package com.alquiler.entities;

import java.sql.Time;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.alquiler.types.FORMA_PAGO;


/**
 * The persistent class for the reserva database table.
 * 
 */
@Entity
@NamedQuery(name="Reserva.findAll", query="SELECT r FROM Reserva r")
public class Reserva extends AbstractEntity {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer idReserva;

	@Temporal(TemporalType.DATE)
	private Date fecha;
	
	@Enumerated
	private FORMA_PAGO forma_Pago;

	private Time horaFinal;

	private Time horaInicial;
	
	private Integer valor;

	//bi-directional many-to-many association to Cancha
	@ManyToMany
	@JoinTable(
		name="reserva_cancha"
		, joinColumns={
			@JoinColumn(name="idReserva")
			}
		, inverseJoinColumns={
			@JoinColumn(name="idCancha")
			}
		)
	private List<Cancha> canchas;

	
	//bi-directional many-to-one association to Usuario
	@ManyToOne
	@JoinColumn(name="idUsuario")
	private Usuario usuario;

	public Reserva() {
	}

	public Integer getIdReserva() {
		return this.idReserva;
	}

	public void setIdReserva(Integer idReserva) {
		this.idReserva = idReserva;
	}

	public Date getFecha() {
		return this.fecha;
	}

	public void setFecha(Date fecha) {
		this.fecha = fecha;
	}

	public FORMA_PAGO getForma_Pago() {
		return this.forma_Pago;
	}

	public void setForma_Pago(FORMA_PAGO forma_Pago) {
		this.forma_Pago = forma_Pago;
	}

	public Time getHoraFinal() {
		return this.horaFinal;
	}

	public void setHoraFinal(Time horaFinal) {
		this.horaFinal = horaFinal;
	}

	public Time getHoraInicial() {
		return this.horaInicial;
	}

	public void setHoraInicial(Time horaInicial) {
		this.horaInicial = horaInicial;
	}

	public Integer getValor() {
		return valor;
	}

	public void setValor(Integer valor) {
		this.valor = valor;
	}

	public List<Cancha> getCanchas() {
		return this.canchas;
	}

	public void setCanchas(List<Cancha> canchas) {
		this.canchas = canchas;
	}
	
	public Usuario getUsuario() {
		return this.usuario;
	}

	public void setUsuario(Usuario usuario) {
		this.usuario = usuario;
	}

}